import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'logic.dart';

class SuddenlyRichPage extends StatelessWidget {
  SuddenlyRichPage({super.key});

  final logic = Get.put(SuddenlyRichLogic());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('暴富')),
      body: Center(
        child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
          Obx(() => Text(
                '${logic.count.value} 注',
                style: const TextStyle(fontSize: 30.0, color: Colors.red),
              )),
          const SizedBox(height: 66, width: 1),
          ElevatedButton(
            onPressed: () => logic.generateRich(),
            child: const Text('暴富'),
          ),
        ]),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () => logic.increment(),
        child: const Icon(Icons.add),
      ),
    );
  }
}
